<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-title" content="">
  <meta name="format-detection" content="telephone=no">
  <meta name="full-screen" content="yes">
  <meta name="x5-page-mode" content="app">
  <meta name="x5-fullscreen" content="true">
  <meta name="browsermode" content="application">
  <meta content="" name="keywords">
  <meta content="" name="description">
  <link rel="stylesheet" href="https://cdn.bootcss.com/weui/1.1.3/style/weui.min.css">
  <link rel="stylesheet" href="https://cdn.bootcss.com/jquery-weui/1.2.1/css/jquery-weui.min.css">
  <link rel="stylesheet" href="./js/layer_mobile/need/layer.css">
  <link rel="stylesheet" href="./css/style.css">
  <link rel="stylesheet" href="./js/dropload/dropload.css">
  <style>
    .weui-form-preview__hd .weui-form-preview__value { font-size: 1.2em; }
    .success { color: #1aad19; }
    .warning { color: #f6bf42; }
    .danger { color: #f76260; }
  </style>
  <title>我的商户</title>

  <body>
    <div class="page__hd">
      <div class="page__title">我的商户</div>
      <div class="page__desc">通过我的<span class="theme-color">二维码</span>申请成为的商户</div>
    </div>

    <!-- <div class="weui-cells">
      <a class="weui-cell weui-cell_access" href="javascript:;">
        <div class="weui-cell__bd">
          <p>watasi信息科技有限公司</p>
        </div>
      </a>
      <a class="weui-cell weui-cell_access" href="javascript:;">
        <div class="weui-cell__bd">
          <p>watasi信息科技有限公司</p>
        </div>
      </a>
    </div> -->
    <script id='mclist' type="text/html">
      <div class="weui-panel weui-panel_access">
        <div class="weui-panel__bd">
          {{#
            for(var i=0; i<d.length; i++) {
              var item = d[i];
          }}
          <div class="weui-form-preview mb20">
            <div class="weui-form-preview__hd">
              <!-- <label class="weui-form-preview__label"></label> -->
              <em class="weui-form-preview__value">{{ item.company }}</em>
            </div>
            <div class="weui-form-preview__bd">
              <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">申请时间</label>
                <span class="weui-form-preview__value">{{ item.create_time }}</span>
              </div>
              <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">状态</label>
                <span class="weui-form-preview__value">
                  {{# if(item.status == 1) { }}
                  <span class="warning">处理中</span>
                  {{# } else if(item.status == 2) { }}
                  <span class="success">成功</span>
                  {{# } else if(item.status == 3) { }}
                  <span class="danger">失败</span>
                  {{# } else if(item.status == -1) { }}
                  <span class="danger">禁用</span>
                  {{# } }}
                </span>
              </div>
            </div>
          </div>
          <!-- <a href="javascript:void(0);" class="weui-media-box weui-media-box_appmsg">
            <div class="weui-media-box__bd">
              <h4 class="weui-media-box__title">{{ item.company }}</h4>
              <p class="weui-media-box__desc">{{ item.create_time }}</p>
            </div>
          </a> -->
          {{# } }}
        </div>
      </div>
    </script>
    <div id="box"></div>
    <div class="dropload-down"><div class="dropload-refresh">↑上拉加载更多</div></div>
  </body>

  <script src="https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
  <script src="./js/dropload/dropload.min.js"></script>
  <script src="https://cdn.bootcss.com/vConsole/3.3.0/vconsole.min.js"></script>
  <script src="./js/tools2.js?ver=2.1"></script>
  <script src="./js/jweixin-1.4.0.js?ver=1.0"></script>
  <script src="./js/layer_mobile/layer.js"></script>
  <script src="./js/layer_mobile/laytpl.js"></script>
  <script>
    // var vConsole = new VConsole();
    var contents = [];
    var page = 0;
    var mclist = $('#mclist').html();
    var pid = tools.getQueryString('pid');
    if(!!pid) {

      tools.login(function() {
        $('.weui-panel__bd').dropload({
          scrollArea : window,
          loadDownFn: function(me) {
            page++;
            tools.ajax({
              url: '/proxy/mch/' + pid,
              data: { page: page },
              success: function(res) {
                if(res.code == 0 && res.data.data && res.data.data.length > 0) {
                  contents = contents.concat(res.data.data);
                } else {
                  me.lock();
                  me.noData();
                }
                laytpl(mclist).render(contents, function(html) {
                  $('#box').html(html);
                  me.resetload();
                })
              },
              error: function(err) {
                // me.resetload();
                me.lock();
                me.noData();
                if(err.status === 403) {
                  tools.wxLogin();
                } else {
                  layer.open({ content: '网络连接出错', skin: 'msg', time: 2 });
                }
              }
            })
          }
        })
      })
    }

    tools.hide();
  </script>
</body>
</html>